﻿<%@ Page Title="" Language="C#" MasterPageFile="~/SiteLED.Master" AutoEventWireup="true" CodeBehind="ListOnePro.aspx.cs" Inherits="lcs.Web.LED.ListOnePro" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <link href="../admin/lib/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
    <link href="../admin/lib/ligerUI/skins/ligerui-icons.css" rel="stylesheet" type="text/css" />
    
    <script src="../admin/lib/ligerUI/js/core/base.js" type="text/javascript"></script>
    <script src="../admin/lib/ligerUI/js/plugins/ligerDrag.js" type="text/javascript"></script>
    <script src="../admin/lib/ligerUI/js/plugins/ligerDialog.js" type="text/javascript"></script>
    <script src="../admin/lib/ligerUI/js/plugins/ligerResizable.js" type="text/javascript"></script>
   
    
     <link href="../jquery-ui.min.css" rel="stylesheet" />   
    <script src="../js/jquery-ui.min.js"></script>
    <script type="text/javascript">       
        var wchartInstance;
        var issopt = "";
        $(function () {
            $("#txtpro").autocomplete({
                 minLength: 2, // 设置搜索的关键字最小长度// 设置自动完成列表的函数，函数包括两个参数，requset和response      
                 source: function (request, response) {
                     $.ajax({
                         type: "POST",          // 通过request.term可以获得文本框内容   
                         url: "../Handler.ashx?keyword=" + request.term,
                         contentType: "application/json; charset=gb2312",
                         dataType: "json",
                         success: function (data) {
                             // jQuery.map(array, callback) :将一个数组中的元素转换到另一个数组中。
                             //  下面就是把数组["value1", "value2",...]转换为[{value:"value1"}, {value:"value2"},...]                 
                             response($.map(data, function (item) {
                                 return { value: item };
                             }));
                         },
                         error: function () {
                             alert("ajax请求失败");
                         }
                     });
                 }
             });
            Highcharts.setOptions({
                lang: {
                    contextButtonTitle: "图表导出菜单",
                    decimalPoint: ".",
                    downloadJPEG: "下载JPEG图片",
                    downloadPDF: "下载PDF文件",
                    downloadPNG: "下载PNG文件",
                    downloadSVG: "下载SVG文件",
                    drillUpText: "返回 {series.name}",
                    loading: "加载中",
                    months: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
                    noData: "没有数据",
                    numericSymbols: ["千", "兆", "G", "T", "P", "E"],
                    printChart: "打印图表",
                    resetZoom: "恢复缩放",
                    resetZoomTitle: "恢复图表",
                    shortMonths: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
                    thousandsSep: ",",
                    weekdays: ["星期一", "星期二", "星期三", "星期三", "星期四", "星期五", "星期六", "星期天"]
                }
            });
            var h = $("#mycenter").height();
            $("#container").height(h-50);
            initchart();
            InitGird();
            changeset();
        });
        function changeset() {
            var val = $("#myinterval").val();
            if (val != "-1") {
                issopt = "0";
                timeid = setInterval(InitGird, val);
            }
            else {
                issopt = "1";
                clearInterval(timeid);
            }
        }
        function initchart() {
            $("#myinterval").change(function () {
                changeset();
            });
            Highcharts.getOptions().colors = Highcharts.map(Highcharts.getOptions().colors, function (color) {
                return {
                    radialGradient: { cx: 0.5, cy: 0.3, r: 0.7 },
                    stops: [
                        [0, color],
                        [1, Highcharts.Color(color).brighten(-0.3).get('rgb')] // darken
                    ]
                };
            });
            // Build the chart
            wchartInstance = new Highcharts.Chart({
            //$('#container').highcharts({
                chart: {
                    renderTo: 'container',
                    plotBackgroundColor: null,
                    plotBorderWidth: null,
                    plotShadow: false
                },
                title: {
                    text: '项目完成情况图'
                },
                tooltip: {
                    pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
                },
                plotOptions: {
                    pie: {
                        allowPointSelect: true,
                        cursor: 'pointer',
                        dataLabels: {
                            enabled: true,
                            format: '<b>{point.name}</b>: {point.y}',
                            style: {
                                color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'
                            },
                            connectorColor: 'silver'
                        }
                    }
                },
                series: [{
                    type: 'pie',
                    name: '数值',
                    data: [

                    ]
                }]
            });
        }
        //初始化表格
        function InitGird() {          
           var proname = $("#txtpro").val();
           $.ajax({
               url: "GetLED.ashx?action=pro&projectName="+proname,
               dataType: 'json',
               type: "post",
               success: function (data) {
                   var sum = data[0].sum;
                   var oversum = data[0].oversum;
                   var sump = data[0].sump;
                   var oversump = data[0].oversump;
                   var noover = parseInt(sum) - parseInt(oversum);
                   var nooverp = (parseInt(sump) - parseInt(oversump)) / 10000;
                   oversump = oversump / 10000;
                   nooverp = nooverp.toFixed(2);
                   oversump = oversump.toFixed(2);
                   var md;
                   var t1 = "['完成(金额：" + oversump + "万)',  " + oversum + "],['未完成(金额：" + nooverp + "万)'," + noover + "]";
                   t1 = t1 = "[" + t1 + "]";
                   wchartInstance.series[0].setData(eval(t1));
               }
           });

        }
        
       
       
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
   
        
            <div class="easyui-panel" id="my1" style="background: #eee; height: 50px;">
               <table cellpadding="0" cellspacing="0" style="width: 100%">
                        <tr>
                            <td style="padding-left: 2px">

                                <div style="padding: 2px;">
                                    项目：<input ID="txtpro"  style="width:200px;"/> 
                                                                      

                                    <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="InitGird()">查找</a> <select id="myinterval" onchange="changeset">
                        <option value="10000">10秒</option>
                        <option value="30000">30秒</option>
                        <option value="60000">1分钟</option>
                        <option value="300000">5分钟</option>
                        <option value="-1">停止</option>

                    </select>
                                      </div>
                            </td>
                        </tr>
                    </table>
            </div>
            <div id="yjfx" class="easyui-panel"  >
                <div id="container" style="min-width:400px;min-height:400px;"></div>
            </div>


        
   
</asp:Content>
